package com.tricode.ile.training.task.sl275.lab1;

public class TestAccount {

    public static void main(String[] args) {
        double balance = 100.0;
        Account account = new Account(balance);
        System.out.println("The current account balance is: " + account.getBalance());

        account.deposit(50.0);
        account.withdraw(147.0);
        System.out.println("The account balance after withdraw is: " + account.getBalance());
    }

    /**
     *
     * @author student
     */
    public static class Account {
        private double balance;

        /** Creates a new instance of Account */
        public Account(double initBalance) {
            balance = initBalance;
        }

        public double getBalance() {
            return balance;
        }

        public void deposit(double amt) {
            balance = balance + amt;
        }

        public void withdraw(double amt) {
            if (balance >= amt) {
                balance = balance - amt;
            }
        }
    }
}
